QuickTime 3 Reference

Previous | Chapter Top | Chapter Contents | Next

Alternate Sources for Sprite Image Data

A sprite in a sprite track can obtain its image data from sources other than the images in the sprite track's key frame sample. The alternate image data overrides a particular image index in the sprite track so that all sprites with that image index will use the image data provided by the alternate source.

A sprite track can receive image data from another track within the same movie, called a modifier track. This is useful for compositing traditional video tracks with sprites. For example, you might create a sprite track in which sprite characters are watching television. The sprite track can receive video from another track, called a modifier track, to use as the image data for the television screen sprite. Other sprites can move in front of and behind the television. A sprite track can have more than one modifier track feeding it image data and more than one sprite can use the image data from a modifier track at one time.

In order for a sprite to receive image data from a modifier track, you must call the AddTrackReference function to link the modifier track to the sprite track that it modifies. In addition, you must update the sprite media's input map with an atom that specifies the input type ( kTrackModifierTypeImage ) and an atom that specifies the index of the image to replace ( kSpritePropertyImageIndex ).

A sprite track can also receive sprite image data from an application. For example, an application might provide live, digitized video data to a sprite track by calling MediaSetNonPrimarySourceData .

In addition to receiving image data, a sprite track can receive modifier track data to control its sprites. Currently, three kinds of modifier inputs are supported: images from a video track ( kTrackModifierTypeImage ), a matrix from a base track ( kTrackModifierObjectMatrix ), and a graphics mode from a base track ( kTrackModifierObjectGraphicsMode ).

For example, a modifier track can send matrices to individual sprites to control their locations. To do this, set up a modifier track, such as a tween track, to send matrix data to the sprite track. You must update the sprite media's input map with an atom that specifies the input type ( kTrackModifierObjectMatrix ) and an atom that specifies the ID of the sprite to replace ( kTrackModifierObjectID ). If the sprite track also contains matrices to move the sprites, the results are undefined.

For background information on modifier tracks, see "Movie Toolbox: Sprite Toolbox."


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next